package com.sunday.ble.orlant.utils;

import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.sunday.ble.orlant.R;
import com.sunday.ble.orlant.utils.statusbar.StatusBarUtil;
import com.sunday.common.utils.DeviceUtils;
import com.sunday.member.base.BaseActivity;

import butterknife.Bind;
import butterknife.ButterKnife;

public class MenuActivity extends BaseActivity {

    @Bind(R.id.img_right)
    ImageView imgRight;
    @Bind(R.id.img_logo)
    ImageView imgLogo;
    @Bind(R.id.light)
    ImageView light;
    @Bind(R.id.up)
    ImageView up;
    @Bind(R.id.kill)
    ImageView kill;
    @Bind(R.id.stop)
    ImageView stop;
    @Bind(R.id.anion)
    ImageView anion;
    @Bind(R.id.down)
    ImageView down;
    @Bind(R.id.convection)
    ImageView convection;
    @Bind(R.id.tvInfo)
    TextView tvInfo;
    @Bind(R.id.option)
    TextView option;
    @Bind(R.id.rMenu)
    RelativeLayout rMenu;

    private int w,h;
    private RelativeLayout.LayoutParams relativeParams;
    private LinearLayout.LayoutParams linerParams;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_menu);
        ButterKnife.bind(this);
        w = DeviceUtils.getDisplay(mContext).widthPixels;
        h = DeviceUtils.getDisplay(mContext).heightPixels;
        StatusBarUtil.setTransparentForImageView(this,null);
        initView();
    }

    private void initView(){
        relativeParams = (RelativeLayout.LayoutParams) rMenu.getLayoutParams();
        relativeParams.leftMargin = 68;
        relativeParams.rightMargin = 68;
        rMenu.setLayoutParams(relativeParams);
        relativeParams = (RelativeLayout.LayoutParams) imgRight.getLayoutParams();
        relativeParams.height = (int) (0.056*h);
        relativeParams.width = relativeParams.height;
        imgRight.setLayoutParams(relativeParams);
        relativeParams = (RelativeLayout.LayoutParams) imgLogo.getLayoutParams();
        relativeParams.height = (int) (0.05*h);
        relativeParams.width = (int) (relativeParams.height*6.1);
        imgLogo.setLayoutParams(relativeParams);
        int menuH = (int) (0.17*h);
        int menuW = (int) (0.17*h*1.37);
        int topMargin = 12;
        relativeParams = (RelativeLayout.LayoutParams) light.getLayoutParams();
        relativeParams.height = menuH;
        relativeParams.width = menuW;
        relativeParams.topMargin = (int) (0.03*h);
        light.setLayoutParams(relativeParams);
        relativeParams = (RelativeLayout.LayoutParams) kill.getLayoutParams();
        relativeParams.height = menuH;
        relativeParams.width = menuW;
        relativeParams.topMargin = topMargin;
        kill.setLayoutParams(relativeParams);
        relativeParams = (RelativeLayout.LayoutParams) up.getLayoutParams();
        relativeParams.height = menuH;
        relativeParams.width = menuW;
        relativeParams.topMargin = topMargin;
        up.setLayoutParams(relativeParams);
        relativeParams = (RelativeLayout.LayoutParams) stop.getLayoutParams();
        relativeParams.height = menuH;
        relativeParams.width = menuW;
        relativeParams.topMargin = topMargin;
        stop.setLayoutParams(relativeParams);
        relativeParams = (RelativeLayout.LayoutParams) anion.getLayoutParams();
        relativeParams.height = menuH;
        relativeParams.width = menuW;
        relativeParams.topMargin = topMargin;
        anion.setLayoutParams(relativeParams);
        relativeParams = (RelativeLayout.LayoutParams) down.getLayoutParams();
        relativeParams.height = menuH;
        relativeParams.width = menuW;
        relativeParams.topMargin = topMargin;
        down.setLayoutParams(relativeParams);
        relativeParams = (RelativeLayout.LayoutParams) convection.getLayoutParams();
        relativeParams.height = menuH;
        relativeParams.width = menuW;
        relativeParams.topMargin = topMargin;
        convection.setLayoutParams(relativeParams);
        linerParams = (LinearLayout.LayoutParams) tvInfo.getLayoutParams();
        linerParams.height = (int) (0.08*h);
        linerParams.width = (int) (linerParams.height*2.76);
        tvInfo.setLayoutParams(linerParams);
    }
}
